﻿<Window x:Class="WindowsUpdateNotifier.MenuView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:app="clr-namespace:WindowsUpdateNotifier"
        xmlns:p="clr-namespace:WindowsUpdateNotifier.Resources" 
        Title="MenuWindow" 
        WindowStartupLocation="Manual"
        Left="0" Top="0" 
        Width="300"
        SizeToContent="Height"
        ShowInTaskbar="False" Topmost="True"
        Background="{StaticResource WindowColor}" WindowStyle="None" AllowsTransparency="True" Loaded="_OnWindowLoaded">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../Styles/Controls.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        
            <BooleanToVisibilityConverter x:Key="BooleanConverter"/>
        </ResourceDictionary>
    </Window.Resources>

    <Window.DataContext>
        <app:MenuViewModel VersionLabel="Version 1.1.0" 
                             CopyrightLabel="Copyright © Christoph Pangerl 2013" 
                             HomepageLink="wun.codeplex.com"
                             NewVersionLabel="(Version 9.9.9 available)"
                             IsNewVersionAvailable="True"
                             UpdateStateText="No Updates Available"/>
    </Window.DataContext>

    <Border BorderBrush="{StaticResource WindowBorderOuter}" BorderThickness="1">
        <Border BorderBrush="{StaticResource WindowBorderMiddle}" BorderThickness="5">
            <Border BorderBrush="{StaticResource WindowBorderInner}" BorderThickness="1">
                
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="60"/>
                        <RowDefinition Height="35"/>
                        <RowDefinition Height="3"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <DockPanel Grid.Row="0">
                        <Image Source="../../../Resources/Images/WindowsUpdate.ico" 
							Width="32" Height="32" Margin="10,5,0,0" DockPanel.Dock="Left"/>

                        <Label Content="{x:Static p:TextResources.WindowTitle_Settings}" FontSize="18" Margin="5,5,0,0" Height="32" />
                    </DockPanel>

                    <DockPanel Grid.Row="1" Background="#F6F7FA">
                        <DockPanel Background="{StaticResource SeparatorColor}" DockPanel.Dock="Top" Height="1"/>

                        <Label Content="{Binding UpdateStateText}" FontSize="12" Margin="15,0,15,0" VerticalAlignment="Center"/>
                    </DockPanel>

                    <DockPanel Grid.Row="2" Background="{StaticResource SeparatorColor}" />

                    <DockPanel Grid.Row="3" Background="{StaticResource ContentAreaColorDark}">
                        <DockPanel>
                            <StackPanel>

                                <Button Style="{DynamicResource MenuButtonStyle}" Content="{x:Static p:TextResources.Menu_StartSearch}" 
                                        Command="{Binding SearchForUpdatesCommand}" IsEnabled="{Binding IsSearchForUpdatesEnabled}"/>
                                
                                <Button Style="{DynamicResource MenuButtonStyle}" Content="{x:Static p:TextResources.Menu_Settings}" Command="{Binding OpenSettingsCommand}"/>
                                <Button Style="{DynamicResource MenuButtonStyle}" Content="{x:Static p:TextResources.Menu_WindowsUpdates}" Command="{Binding OpenWindowsUpdateControlPanelCommand}"/>
                                <Button Style="{DynamicResource MenuButtonStyle}" Content="{x:Static p:TextResources.Menu_Exit}" Command="{Binding ShutdownCommand}"/>
                                
                                <StackPanel Margin="20, 20, 20, 10" HorizontalAlignment="Center">
                                    <DockPanel HorizontalAlignment="Center">
                                        <Label Margin="0" Content="{Binding VersionLabel}"/>

                                        <Label Margin="10,0,0,0" Content="{Binding NewVersionLabel}"
											Visibility="{Binding IsLatestVersion, Converter={StaticResource BooleanConverter}}" />

                                        <Label Margin="10,0,0,0" FontWeight="Medium"
                                               Visibility="{Binding IsNewVersionAvailable, Converter={StaticResource BooleanConverter}}">
                                            <Hyperlink Command="{Binding OpenDownloadPageCommand}" Foreground="{StaticResource LabelForegroundColor}">
                                                <InlineUIContainer>
                                                    <TextBlock Text="{Binding NewVersionLabel}" />
                                                </InlineUIContainer>
                                            </Hyperlink>
                                        </Label>
                                    </DockPanel>

                                    <Label Margin="0,2,0,0" Content="{Binding CopyrightLabel}" HorizontalAlignment="Center"/>

                                    <Label Margin="0,5,0,0" HorizontalAlignment="Center">
                                        <Hyperlink Command="{Binding OpenHomepageCommand}">
                                            <InlineUIContainer>
                                                <TextBlock Text="{Binding HomepageLink}" />
                                            </InlineUIContainer>
                                        </Hyperlink>
                                    </Label>

                                </StackPanel>
                            </StackPanel>
                        </DockPanel>
                    </DockPanel>
                
                </Grid>
                
            </Border>
        </Border>
    </Border>
</Window>
